package com.SunSoft.PhoneRemoteControl;

import I;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.Vibrator;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.View.OnTouchListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.tasogo.comm.b;
import com.tasogo.comm.g;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Timer;
import org.apache.http.util.EncodingUtils;

public class Show_Search extends Activity
{
  public static final float[] a = { 0.5F, 0.0F, 0.0F, 0.0F, 2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 2.0F, 0.0F, 0.0F, 0.5F, 0.0F, 2.0F, 0.0F, 0.0F, 0.0F, 0.5F, 0.0F };
  private static com.tasogo.comm.e aY;
  public static final float[] b = { 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F };
  public static ArrayList h = new ArrayList();
  public static ArrayList i = new ArrayList();
  public static ArrayList j = new ArrayList();
  RadioButton A;
  RadioButton B;
  int C;
  String D;
  List E;
  boolean F;
  boolean G;
  boolean H;
  boolean I;
  boolean J;
  boolean K;
  int L;
  boolean M;
  int N;
  int O;
  boolean P;
  boolean Q;
  boolean R;
  int S;
  boolean T;
  boolean U;
  TableLayout V;
  String[] W;
  String X;
  String Y;
  byte[] Z;
  boolean aA;
  String aB;
  Handler aC;
  private ArrayAdapter aD;
  private ArrayAdapter aE;
  private ArrayAdapter aF;
  private String[] aG;
  private String[] aH;
  private String[] aI;
  private String[] aJ;
  private CustomerSpinner aK;
  private CustomerSpinner aL;
  private SQLiteDatabase aM;
  private SQLiteDatabase aN;
  private AudioManager aO;
  private int aP;
  private int aQ;
  private int aR;
  private MediaPlayer aS;
  private fq[] aT;
  private fq[] aU;
  private String[] aV;
  private int aW;
  private fr[] aX;
  private String aZ;
  int aa;
  String ab;
  di ac;
  dh ad;
  int ae;
  int af;
  int ag;
  int ah;
  int ai;
  int aj;
  String ak;
  String al;
  TextView am;
  String an;
  String ao;
  int ap;
  int aq;
  int ar;
  int as;
  int at;
  int[] au;
  String[] av;
  Object[] aw;
  boolean ax;
  boolean ay;
  boolean az;
  private int ba;
  private boolean bb;
  private Runnable bc;
  private Runnable bd;
  private View.OnLongClickListener be;
  private View.OnClickListener bf;
  private View.OnClickListener bg;
  private View.OnClickListener bh;
  private View.OnClickListener bi;
  private View.OnTouchListener bj;
  private View.OnClickListener bk;
  private View.OnClickListener bl;
  String[][] c;
  String[][] d;
  int[][] e;
  int f;
  AutoCompleteTextView g;
  int k;
  e l;
  f m;
  String n;
  String o;
  ImageView p;
  TextView q;
  TextView r;
  TextView s;
  LinearLayout t;
  LinearLayout u;
  ImageView v;
  RadioButton w;
  RadioButton x;
  RadioButton y;
  RadioButton z;

  public Show_Search()
  {
    Object localObject1 = { "音量加", "电源", "静音" };
    Object localObject2 = { "电源", "温度加" };
    String[] arrayOfString1 = { "音量加", "下一首", "快进" };
    this.c = new String[][] { { "音量加", "电源", "信号源", "频道加" }, localObject1, { "频道加", "电源", "音量加" }, { "电源", "音量加", "菜单" }, localObject2, arrayOfString1, { "电源", "风速" }, { "快门" }, { "电源", "播放", "音量加", "下一首" }, { "电源", "菜单" }, { "按键1" } };
    localObject1 = new String[] { "CH+", "Power", "Vol+" };
    localObject2 = new String[] { "Vol+", "Next", "FastPlay" };
    arrayOfString1 = new String[] { "Flash" };
    String[] arrayOfString2 = { "Power", "Menu" };
    String[] arrayOfString3 = { "Key1" };
    this.d = new String[][] { { "Vol+", "Power", "TV/AV", "CH+" }, { "Vol+", "Power", "Mute" }, localObject1, { "Power", "Vol+", "Menu" }, { "Power", "Temp+" }, localObject2, { "Power", "FanSpeed" }, arrayOfString1, { "Power", "Play", "Vol+", "Next" }, arrayOfString2, arrayOfString3 };
    localObject1 = new int[] { 1 };
    localObject2 = new int[] { 1, 8 };
    this.e = new int[][] { { 10, 1, 2, 3 }, { 11, 1, 2 }, { 3, 1, 10 }, { 1, 11, 5 }, { 1, 3 }, { 11, 17, 19 }, { 1, 2 }, localObject1, { 2, 3, 7, 6 }, localObject2, { 1 } };
    this.f = 0;
    this.k = 1;
    this.C = 0;
    this.E = null;
    this.F = true;
    this.G = false;
    this.H = true;
    this.I = false;
    this.J = true;
    this.K = false;
    this.L = 0;
    this.M = false;
    this.N = 0;
    this.O = 60;
    this.P = false;
    this.Q = false;
    this.R = false;
    this.S = 0;
    this.T = false;
    this.U = true;
    this.W = new String[24];
    this.aa = 0;
    this.ae = 0;
    this.ag = 5;
    this.ah = 0;
    this.aW = 0;
    this.ai = 1;
    this.aj = 0;
    this.aX = new fr[30];
    this.an = "";
    this.ao = MainControl.i;
    this.ap = 0;
    this.aq = 0;
    this.ar = 8;
    this.as = 0;
    this.at = 1;
    localObject1 = new int[5];
    localObject1[2] = 8;
    localObject1[4] = 1;
    this.au = ((I)localObject1);
    this.ba = 0;
    this.bb = true;
    this.ax = false;
    this.ay = false;
    this.az = false;
    this.aA = false;
    this.aC = new er(this);
    this.bc = new ff(this);
    this.bd = new fg(this);
    this.be = new fh(this);
    this.bf = new fi(this);
    this.bg = new fj(this);
    this.bh = new fk(this);
    this.bi = new fm(this);
    this.bj = new fn(this);
    this.bk = new eu(this);
    this.bl = new ev(this);
  }

  private static String a(long paramLong)
  {
    int i1;
    String str2 = "";
    long l1 = paramLong;
    if (paramLong == 0L)
    {
      return "00";
      i1 = (int)l1 % 16;
      switch (i1)
      {
      default:
      case 10:
      case 11:
      case 12:
      case 13:
      case 14:
      case 15:
      }
    }
    for (String str1 = String.valueOf(i1); ; str1 = "F")
      while (true)
      {
        do
        {
          str2 = str1 + str2;
          l1 /= 16L;
        }
        while (l1 > 0L);
        if (str2.length() != 1)
          break label180;
        return "0" + str2;
        str1 = "A";
        continue;
        str1 = "B";
        continue;
        str1 = "C";
        continue;
        str1 = "D";
        continue;
        str1 = "E";
      }
    label180: return str2;
  }

  public static String a(String paramString)
  {
    String str2 = "";
    if (paramString == null)
      str1 = "";
    do
    {
      return str1;
      str1 = paramString;
    }
    while (paramString.length() < 2);
    int i1 = 0;
    if (i1 >= paramString.length() / 2)
      return str2;
    String str1 = paramString.substring(i1 * 2, i1 * 2 + 2);
    long l1 = 0L;
    int i2 = 1;
    if (i2 > str1.length())
    {
      l1 = (int)l1;
      str1 = "";
      if (l1 > 0L)
        break label207;
    }
    while (true)
    {
      while (str1.length() >= 8)
      {
        while (true)
        {
          while (true)
          {
            str1 = c(a(a(a(str1, 0, 6), 1, 7), 2, 3));
            str2 = str2 + str1;
            i1 += 1;
          }
          int i3 = "0123456789ABCDEF".indexOf(str1.substring(str1.length() - i2, str1.length() - i2 + 1));
          l1 = ()(l1 + Math.pow(16.0D, i2 - 1) * i3);
          i2 += 1;
        }
        label207: str1 = (l1 % 2L) + str1;
        l1 /= 2L;
      }
      str1 = "0" + str1;
    }
  }

  private static String a(String paramString, int paramInt1, int paramInt2)
  {
    int i1;
    Object localObject1 = "";
    Object localObject2 = localObject1;
    if (paramString.length() == 8)
    {
      i1 = 0;
      if (i1 < 8)
        break label33;
      localObject2 = localObject1;
    }
    return localObject2;
    if ((i1 == paramInt1) || (i1 == paramInt2))
    {
      label33: localObject2 = localObject1;
      if (i1 == paramInt1)
        localObject2 = localObject1 + paramString.substring(paramInt2, paramInt2 + 1);
      localObject1 = localObject2;
      if (i1 != paramInt2);
    }
    for (localObject1 = localObject2 + paramString.substring(paramInt1, paramInt1 + 1); ; localObject1 = localObject1 + paramString.substring(i1, i1 + 1))
      while (true)
        i1 += 1;
  }

  public static void a(String paramString1, String paramString2)
  {
    MyApplication.a();
    MyApplication.a(paramString1, paramString2);
  }

  private static String b(long paramLong)
  {
    String str3 = "";
    String str4 = a(paramLong);
    String str1 = str3;
    String str2 = str4;
    if (str4.length() % 2 != 0)
    {
      str2 = "0" + str4;
      str1 = str3;
    }
    if (str2.length() <= 1);
    while (true)
    {
      while (str1.length() >= 8)
      {
        return str1;
        str1 = str1 + str2.substring(str2.length() - 2);
        str2 = str2.substring(0, str2.length() - 2);
      }
      str1 = str1 + "0";
    }
  }

  private String b(String paramString)
  {
    paramString = paramString.toUpperCase();
    StringBuilder localStringBuilder = new StringBuilder("");
    while (true)
    {
      if (paramString.length() <= 0)
        return localStringBuilder.toString();
      if (paramString.length() <= 1)
        continue;
      String str = paramString.substring(0, 2);
      int i1 = Integer.parseInt(str.substring(1), 16);
      localStringBuilder.append(this.W[i1]);
      i1 = Integer.parseInt(str.substring(0, 1), 16);
      localStringBuilder.append(this.W[i1]);
      if (paramString.length() == 1)
        paramString = "";
      paramString = paramString.substring(2);
    }
  }

  private static String c(String paramString)
  {
    int i1 = 0;
    int i5 = paramString.length();
    int i2 = 0;
    if (i1 >= paramString.length());
    for (paramString = a(i2); ; paramString = "0" + paramString)
      while (paramString.length() >= 2)
      {
        int i4;
        return paramString;
        int i3 = i2;
        if (paramString.charAt(i1) == '1')
          i4 = i2 + (int)Math.pow(2.0D, i5 - 1 - i1);
        i1 += 1;
        i2 = i4;
      }
  }

  private void c()
  {
    try
    {
      ((Vibrator)getSystemService("vibrator")).vibrate(new long[] { 6L, 10L, 6L, 10L }, -1);
      if (this.ba == 0)
      {
        if (this.aS == null)
          this.aS = new MediaPlayer();
        this.aS.reset();
        this.aS.setLooping(false);
        FileInputStream localFileInputStream = new FileInputStream(new File("/data/data/com.SunSoft.PhoneRemoteControl/tsg_temp.tsg"));
        this.aS.setDataSource(localFileInputStream.getFD());
        this.aS.prepare();
        this.aS.start();
        return;
      }
      if (this.aZ == null)
        this.aZ = this.ac.b("");
      try
      {
        if ((this.ba != 1) && (this.ba != 2) && (this.ba != 5) && (this.ba != 3))
          break label214;
        this.bb = aY.a(this.aZ, 0);
        return;
      }
      catch (NullPointerException localNullPointerException)
      {
        this.bb = false;
        return;
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      this.bb = false;
      return;
    }
    if (this.ba != 4)
      label214: return;
    this.bb = aY.a(this.aZ, 1);
  }

  private String d(String paramString)
  {
    try
    {
      InputStreamReader localInputStreamReader = new InputStreamReader(getResources().getAssets().open(paramString));
      BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader);
      paramString = "";
      String str = localBufferedReader.readLine();
      if (str == null)
      {
        localInputStreamReader.close();
        return paramString;
      }
      paramString = paramString + str;
    }
    catch (Exception paramString)
    {
      paramString.printStackTrace();
    }
    return "";
  }

  private void d()
  {
    int i2 = 0;
    h.clear();
    Object localObject = String.valueOf("");
    localObject = this.aM.rawQuery("select ID,define_ID,ico_img,name_ch,name_en ,template_file from control_type where define_ID <> ? order by ID", new String[] { localObject });
    this.aG = new String[((Cursor)localObject).getCount()];
    int i1 = 0;
    if (i1 >= 20)
      i1 = i2;
    while (true)
    {
      while (!(((Cursor)localObject).moveToNext()))
      {
        ((Cursor)localObject).close();
        return;
        this.aX[i1] = new fr(this);
        i1 += 1;
      }
      i2 = ((Cursor)localObject).getInt(((Cursor)localObject).getColumnIndex("ID"));
      ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex("define_ID"));
      this.aX[i2].a = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex("define_ID"));
      this.aX[i2].c = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex(this.o));
      String str = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex("ico_img"));
      int i3 = getResources().getIdentifier(str, "drawable", "com.SunSoft.PhoneRemoteControl");
      this.aX[i2].b = i3;
      str = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex("template_file"));
      i3 = getResources().getIdentifier(str, "layout", "com.SunSoft.PhoneRemoteControl");
      this.aX[i2].d = i3;
      this.aG[i1] = this.aX[i2].c;
      h.add(this.aX[i2].c);
      i1 += 1;
    }
  }

  private void e()
  {
    Object localObject = this.aM.rawQuery("select control_model ,control_type from control_list where control_type=3 and control_model<>'' group by control_model", new String[0]);
    Cursor localCursor = this.aM.rawQuery("select ID,brand_ch,brand_en ,control_type from brand_list where control_type=3 and brand_ch<>''  order by " + this.n, new String[0]);
    this.aE = new ArrayAdapter(this, 17367057, new String[0]);
    this.aI = new String[((Cursor)localObject).getCount()];
    this.aJ = new String[((Cursor)localObject).getCount() + localCursor.getCount()];
    int i1 = 0;
    if (!(((Cursor)localObject).moveToNext()))
      ((Cursor)localObject).close();
    while (true)
    {
      while (!(localCursor.moveToNext()))
      {
        String str;
        do
        {
          localCursor.close();
          this.aF = new ArrayAdapter(this, 17367057, this.aJ);
          return;
          str = ((Cursor)localObject).getString(0);
        }
        while ((str == null) || (str.equals("")));
        this.aI[i1] = str;
        this.aJ[i1] = str;
        i1 += 1;
      }
      localObject = localCursor.getString(localCursor.getColumnIndex(this.n));
      if ((localObject == null) || (((String)localObject).equals("")))
        continue;
      this.aJ[i1] = localObject;
      i1 += 1;
    }
  }

  private void f()
  {
    int i2 = 0;
    while (true)
    {
      try
      {
        Object localObject;
        InputStreamReader localInputStreamReader = new InputStreamReader(getResources().getAssets().open("tsg_str.tsg"));
        BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader);
        i1 = 0;
        break label156:
        do
        {
          if (!(localBufferedReader.ready()))
          {
            localBufferedReader.close();
            localInputStreamReader.close();
            return;
            this.W[i1] = "";
            i1 += 1;
            break label156:
          }
          localObject = new StringBuilder("");
          ((StringBuilder)localObject).append(localBufferedReader.readLine());
          localObject = EncodingUtils.getString(((StringBuilder)localObject).toString().getBytes(), "UTF-8");
        }
        while (((String)localObject).length() <= 4);
        if (i1 == 0)
        {
          this.W[i1] = ((String)localObject).substring(1);
          break label167:
        }
        this.W[i1] = localObject;
      }
      catch (IOException localIOException)
      {
        localIOException.printStackTrace();
        return;
      }
      label156: if (i1 < 24)
        continue;
      int i1 = i2;
      continue;
      label167: i1 += 1;
    }
  }

  final void a()
  {
    Object localObject;
    int i1 = 0;
    this.k = 1;
    this.aW = 0;
    this.T = false;
    this.af = this.ag;
    this.U = true;
    String str1 = "";
    String str2 = this.g.getText().toString();
    if (str2.equals(""))
    {
      localObject = str1;
      if (this.af != 3)
        break label173;
      localObject = str1;
      if (this.L <= 0)
        break label173;
    }
    if (this.af == 3)
      if (this.L == 0)
      {
        localObject = "" + " and (control_model  like '%" + str2 + "%' or brand_ch like  '%" + str2 + "%' or brand_en like '%" + str2 + "%'   or  " + this.o + " like '%" + str2 + "%') ";
        label173: this.an = ((String)localObject);
        a("Test", "SQL:" + ((String)localObject));
        a("Test", "type_id:" + String.valueOf(this.af));
        if (this.af != 1)
          break label574;
        localObject = this.aM.rawQuery("select ID,control_type,name_ch,name_en,brand_ch,brand_en,control_model,define_ID, device_ID,Control_version from control_list where control_type = ? " + ((String)localObject) + " order by Control_version desc,ID desc", new String[] { String.valueOf(this.af) });
        if (((Cursor)localObject).getCount() <= 0)
          break label823;
        this.aW = ((Cursor)localObject).getCount();
        if (this.aW <= 1200)
          break label622;
        Toast.makeText(this, getString(2131099738), 0).show();
        this.am.setText(getString(2131099738));
        this.aW = 0;
      }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              ((Cursor)localObject).close();
              return;
              if (this.L != 1)
                break;
              localObject = "" + " and (" + this.n + " like '%电信%' or name_ch like '%电信%' or control_model like '%电信%' or " + this.n + " like '%Telecom%' or " + this.n + " like '%IPTV%') ";
            }
            localObject = "" + " and (" + this.n + " like '%卫星%' or name_ch like '%卫星%' or control_model like '%卫星%' or " + this.n + " like '%DVB%' or " + this.n + " like '%Satellite%') ";
          }
          localObject = "" + " and (control_model  like '%" + str2 + "%' or brand_ch like  '%" + str2 + "%' or brand_en like '%" + str2 + "%'   or  " + this.o + " like '%" + str2 + "%') ";
        }
        label574: localObject = this.aM.rawQuery("select ID,control_type,name_ch,name_en,brand_ch,brand_en,control_model,define_ID, device_ID,Control_version from control_list where control_type = ? " + ((String)localObject) + " order by Control_version desc,ID", new String[] { String.valueOf(this.af) });
      }
      label622: this.aT = new fq[this.aW];
      this.r.setText(String.valueOf(this.aW));
      while (true)
      {
        if (((Cursor)localObject).moveToNext());
        this.aT[i1] = new fq(this);
        this.aT[i1].a = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex(this.o));
        this.aT[i1].f = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex(this.n));
        this.aT[i1].c = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex("define_ID"));
        this.aT[i1].d = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex("device_ID"));
        this.aT[i1].e = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex("control_model"));
        this.aT[i1].b = ((Cursor)localObject).getInt(((Cursor)localObject).getColumnIndex("ID"));
        i1 += 1;
      }
      label823: Toast.makeText(this, getString(2131099740), 0).show();
      this.am.setText(getString(2131099740));
      this.r.setText("0");
      this.q.setText("0");
    }
  }

  final void a(int paramInt)
  {
    Object localObject1;
    EditText localEditText;
    AlertDialog.Builder localBuilder;
    if (paramInt == 0);
    for (this.ab = this.aT[(this.k - 1)].d; ; this.ab = this.aU[this.ah].d)
    {
      a("Test", "save_device_id:" + this.ab);
      localObject1 = this.ab;
      localObject1 = this.aM.rawQuery("select ID,control_type,name_ch,name_en,brand_ch,brand_en,control_model,define_ID ,device_ID,control_version,come_from,note, update_time from control_list where device_ID = ?", new String[] { localObject1 });
      if (((Cursor)localObject1).moveToNext())
      {
        Cursor localCursor = this.aN.rawQuery("select ID,control_type,name_ch,name_en,device_ID from control_list where device_ID = ?", new String[] { this.ab });
        if (!(localCursor.moveToNext()))
          break;
        localObject2 = localCursor.getString(localCursor.getColumnIndex(this.o));
        localObject2 = getString(2131099741).replace("***", (CharSequence)localObject2);
        new AlertDialog.Builder(this).setTitle(this.ao).setMessage((CharSequence)localObject2).setNegativeButton(getString(2131099653), new fc(this)).show();
        localCursor.close();
      }
      ((Cursor)localObject1).close();
      return;
    }
    this.aw = new Object[13];
    this.aw[1] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("define_ID"));
    this.aw[2] = Integer.valueOf(((Cursor)localObject1).getInt(((Cursor)localObject1).getColumnIndex("control_type")));
    Object localObject2 = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("name_ch"));
    Object localObject3 = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("name_en"));
    if ((localObject2 != null) && (!(((String)localObject2).equals(""))))
    {
      this.aw[3] = localObject2;
      if ((localObject3 == null) || (((String)localObject3).equals("")))
        break label736;
      this.aw[12] = localObject3;
      localObject2 = this.g.getText().toString();
      if ((localObject2 == null) || (((String)localObject2).equals("")) || (!(((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex(this.n)).contains((CharSequence)localObject2))))
        break label782;
      if (!(this.F))
        break label749;
      this.aw[4] = localObject2;
      this.aw[11] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("brand_en"));
      this.aw[5] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("control_model"));
      this.aw[6] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("control_version"));
      this.aw[7] = "1";
      this.aw[8] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("device_ID"));
      this.aw[9] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("note"));
      this.aw[10] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("update_time"));
      localObject2 = LayoutInflater.from(this).inflate(2130903062, null);
      localObject3 = (EditText)((View)localObject2).findViewById(2131165232);
      localEditText = (EditText)((View)localObject2).findViewById(2131165233);
      localBuilder = new AlertDialog.Builder(this);
      if (!(this.F))
        break label828;
      ((EditText)localObject3).setText(this.aw[3].toString());
      localEditText.setText(this.aw[4].toString());
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                localBuilder.setTitle(2131099807);
                localBuilder.setView((View)localObject2);
                localBuilder.setPositiveButton(getString(2131099653), new fd(this, (EditText)localObject3, localEditText));
                localBuilder.setNegativeButton(getString(2131099654), new fe(this));
                localBuilder.show();
              }
              this.aw[3] = "新设备";
            }
            label736: this.aw[12] = "New device";
          }
          label749: this.aw[11] = localObject2;
          this.aw[4] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("brand_ch"));
        }
        label782: this.aw[4] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("brand_ch"));
        this.aw[11] = ((Cursor)localObject1).getString(((Cursor)localObject1).getColumnIndex("brand_en"));
      }
      label828: ((EditText)localObject3).setText(this.aw[12].toString());
      localEditText.setText(this.aw[11].toString());
    }
  }

  public final void b(int paramInt)
  {
    Object localObject = String.valueOf("");
    localObject = this.aM.rawQuery("select ID,brand_ch,brand_en ,control_type from brand_list where control_type=? and brand_ch<>?  order by " + this.n, new String[] { String.valueOf(paramInt), localObject });
    this.aH = new String[((Cursor)localObject).getCount()];
    int i1 = 0;
    if (!(((Cursor)localObject).moveToNext()))
    {
      ((Cursor)localObject).close();
      this.aD = new ArrayAdapter(this, 17367057, this.aH);
      this.aL.a(j);
      this.aL.setSelection(4, true);
      i.clear();
      if (!(this.F))
        break label361;
      i1 = 0;
      if (i1 < this.c[(paramInt - 1)].length)
        break label337;
      this.aL.a(i);
      this.aL.setSelection(0, true);
      this.f = 0;
      this.u.setVisibility(0);
      if (paramInt != 3)
        break label412;
      this.g.setAdapter(this.aF);
      this.s.setText(getString(2131099705));
      this.g.setHint(getString(2131099711));
      this.t.setVisibility(0);
      if (this.L != 0)
        break label400;
      this.u.setVisibility(0);
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          this.g.setText("");
          if ((this.L == 0) && (paramInt == 3))
          {
            String str = this.ad.a("user_province");
            localObject = str;
            if (str.length() > 2)
              localObject = str.substring(0, 2);
            this.g.setText((CharSequence)localObject);
          }
          return;
          this.aH[i1] = ((Cursor)localObject).getString(((Cursor)localObject).getColumnIndex(this.n));
          i1 += 1;
        }
        label337: i.add(this.c[(paramInt - 1)][i1]);
        i1 += 1;
      }
      label361: i1 = 0;
      while (true)
      {
        if (i1 < this.d[(paramInt - 1)].length);
        i.add(this.d[(paramInt - 1)][i1]);
        i1 += 1;
      }
      label400: this.u.setVisibility(8);
      continue;
      label412: this.g.setAdapter(this.aD);
      this.s.setText(getString(2131099704));
      this.t.setVisibility(8);
      this.g.setHint(getString(2131099709));
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    int i1;
    super.onCreate(paramBundle);
    setContentView(2130903046);
    this.F = Locale.getDefault().getLanguage().toString().equals("zh");
    paramBundle = (TextView)findViewById(2131165185);
    if (this.F)
    {
      paramBundle.setText(MainControl.g + "-" + getString(2131099811));
      this.ao = MainControl.i;
      this.n = "brand_ch";
      this.o = "name_ch";
      this.ad = new dh(this);
      this.ac = new di();
      paramBundle = this.ad.a("save_speed");
      a("Test", "save_speed:" + paramBundle);
      if (paramBundle.equals(""))
        this.ae = 1;
      if (paramBundle.length() > 0)
        this.ae = Integer.parseInt(paramBundle);
      if ((this.ae < 0) || (this.ae > 2))
        this.ae = 1;
      this.l = new e(getBaseContext());
      this.m = new f(getBaseContext());
      this.aM = this.l.getWritableDatabase();
      this.aN = this.m.getWritableDatabase();
      if (!(this.ad.a("is_rotray").equals("1")))
        break label1592;
      setRequestedOrientation(9);
      this.V = ((TableLayout)findViewById(2131165243));
      this.am = ((TextView)findViewById(2131165245));
      this.s = ((TextView)findViewById(2131165411));
      this.q = ((TextView)findViewById(2131165419));
      this.r = ((TextView)findViewById(2131165422));
      this.w = ((RadioButton)findViewById(2131165414));
      this.x = ((RadioButton)findViewById(2131165415));
      this.y = ((RadioButton)findViewById(2131165416));
      this.z = ((RadioButton)findViewById(2131165297));
      this.A = ((RadioButton)findViewById(2131165298));
      this.B = ((RadioButton)findViewById(2131165409));
      this.z.setChecked(true);
      switch (this.ae)
      {
      default:
        this.w.setOnClickListener(this.bk);
        this.x.setOnClickListener(this.bk);
        this.y.setOnClickListener(this.bk);
        this.z.setOnClickListener(this.bl);
        this.A.setOnClickListener(this.bl);
        this.B.setOnClickListener(this.bl);
        this.ae = (this.ae * 8 + 8);
        a("Test", "save_speed_value:" + String.valueOf(this.ae));
        this.p = ((ImageView)findViewById(2131165417));
        this.p.setOnClickListener(this.bi);
        this.p.setOnLongClickListener(this.be);
        this.v = ((ImageView)findViewById(2131165201));
        ((ImageView)findViewById(2131165348)).setOnClickListener(new ew(this));
        paramBundle = (ImageView)findViewById(2131165405);
        Object localObject = (ImageView)findViewById(2131165424);
        paramBundle.setOnClickListener(this.bh);
        ((ImageView)localObject).setOnClickListener(this.bh);
        if (!(MainControl.f))
        {
          paramBundle.setVisibility(8);
          ((ImageView)localObject).setVisibility(8);
        }
        this.g = ((AutoCompleteTextView)findViewById(2131165233));
        this.t = ((LinearLayout)findViewById(2131165407));
        this.u = ((LinearLayout)findViewById(2131165410));
        ((ImageView)findViewById(2131165425)).setOnClickListener(this.bf);
        ((ImageView)findViewById(2131165398)).setOnClickListener(this.bg);
        ((ImageView)findViewById(2131165420)).setOnTouchListener(this.bj);
        ((ImageView)findViewById(2131165418)).setOnTouchListener(this.bj);
        ((ImageView)findViewById(2131165421)).setOnTouchListener(this.bj);
        ((ImageView)findViewById(2131165423)).setOnTouchListener(this.bj);
        this.aL = ((CustomerSpinner)findViewById(2131165412));
        j.clear();
        i1 = 0;
        if (i1 <= 5)
          break label1633;
        paramBundle = this.ad.a("save_type");
        if (!(paramBundle.equals("")))
          break label1651;
        this.ag = 5;
        if (this.ag > 10)
          this.ag = 5;
        this.af = this.ag;
        e();
        d();
        this.aK = ((CustomerSpinner)findViewById(2131165406));
        this.aK.a(h);
        a("Test", "temp_type_id:" + String.valueOf(this.ag));
        b(this.af);
        this.aK.setSelection(this.af - 1);
        this.aK.setOnItemSelectedListener(new ex(this));
        this.aL.setOnItemSelectedListener(new fa(this));
        this.g.setAdapter(this.aD);
        this.aO = ((AudioManager)getSystemService("audio"));
        this.aP = this.aO.getStreamMaxVolume(3);
        this.aQ = this.aO.getStreamVolume(3);
        paramBundle = this.ad.a("save_vol");
        if (!(paramBundle.equals("")))
          break label1662;
        this.aR = this.aP;
        if ((this.aR < this.aP - 1) && (MainControl.k))
          this.aR = (this.aP - 1);
        this.aS = new MediaPlayer();
        this.aS.setOnCompletionListener(new fb(this));
        MyApplication.a().a(this);
        localObject = this.ad.a("save_power");
        if (localObject != null)
        {
          paramBundle = (Bundle)localObject;
          if (!(((String)localObject).equals("")))
            break label1222;
        }
        paramBundle = "2";
        if ((paramBundle != null) && (paramBundle.length() > 0))
          label1222: this.O = (Integer.parseInt(paramBundle) * 10 + 40);
        this.aA = this.ad.a("is_vibrate").equals("1");
        if (!(this.ad.a("is_mono").equals("1")))
          break label1676;
        this.X = d("sstart.tsg");
        this.Y = d("end.tsg");
        this.aa = (this.Y.length() / 2);
        this.Z = new byte[this.aa];
        i1 = 0;
        if (i1 < this.aa)
          break label1690;
        f();
        this.ax = this.ad.a("is_start_power").equals("1");
        if (this.ax)
        {
          new Timer().schedule(new ft(this), 200L);
          this.ay = true;
          new Timer().schedule(new fu(this), 2000L);
        }
        paramBundle = this.ad.a("save_device");
        a("Test", "get_device:" + paramBundle);
        if (!(paramBundle.equals("")))
          break label1724;
        this.ba = 0;
        if (this.ba <= 0)
          break label1493;
      case 0:
      case 1:
      case 2:
      }
    }
    while (true)
      try
      {
        while (this.ba == 3)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                while (true)
                {
                  while (true)
                  {
                    while (true)
                    {
                      while (true)
                      {
                        while (true)
                        {
                          while (true)
                          {
                            while (true)
                            {
                              aY = new g();
                              label1493: new Thread(this.bc).start();
                              ((TelephonyManager)getSystemService("phone")).listen(new fs(this, 0), 32);
                              return;
                              paramBundle.setText(MainControl.h + "-" + getString(2131099811));
                              this.ao = MainControl.j;
                              this.n = "brand_en";
                              this.o = "name_en";
                            }
                            label1592: setRequestedOrientation(1);
                          }
                          this.w.setChecked(true);
                        }
                        this.x.setChecked(true);
                      }
                      this.y.setChecked(true);
                    }
                    label1633: j.add(String.valueOf(i1));
                    i1 += 1;
                  }
                  label1651: this.ag = Integer.parseInt(paramBundle);
                }
                label1662: this.aR = Integer.valueOf(paramBundle).intValue();
              }
              label1676: this.X = d("start.tsg");
            }
            label1690: this.Z[i1] = (byte)Integer.parseInt(this.Y.substring(i1 * 2, i1 * 2 + 2), 16);
            i1 += 1;
          }
          label1724: this.ba = Integer.valueOf(paramBundle).intValue();
        }
        aY = new b();
      }
      catch (java.lang.NoClassDefFoundError paramBundle)
      {
        this.bb = false;
      }
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    if (this.F)
    {
      paramMenu.add(0, 3, 3, "返回");
      paramMenu.add(0, 4, 4, "退出");
    }
    while (true)
    {
      return true;
      paramMenu.add(0, 3, 3, "Return");
      paramMenu.add(0, 4, 4, "Exit");
    }
  }

  protected void onDestroy()
  {
    this.G = true;
    this.Q = false;
    this.M = false;
    this.ad.a("save_type", String.valueOf(this.ag));
    if (this.aS != null)
      this.aS.release();
    if (this.aN != null)
      this.aN.close();
    if (this.aM != null)
      this.aM.close();
    super.onDestroy();
    System.gc();
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (paramInt == 4)
    {
      this.G = true;
      this.Q = false;
      finish();
      return true;
    }
    if (paramInt == 24)
    {
      this.aO.setStreamVolume(3, this.aP, 1);
      this.aQ = this.aO.getStreamVolume(3);
      this.aR = this.aQ;
      if (this.aR < this.aP - 1)
        this.aR = (this.aP - 1);
      this.ad.a("save_vol", String.valueOf(this.aR));
      a("Test", "currentVolume:" + String.valueOf(this.aQ));
      c();
      return true;
    }
    if (paramInt == 25)
    {
      this.aO.setStreamVolume(3, this.aP - 1, 1);
      this.aQ = this.aO.getStreamVolume(3);
      this.aR = this.aQ;
      if (this.aR < this.aP - 1)
        this.aR = (this.aP - 1);
      this.ad.a("save_vol", String.valueOf(this.aR));
      a("Test", "currentVolume:" + String.valueOf(this.aQ));
      c();
      return true;
    }
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    if (paramMenuItem.getItemId() == 3)
    {
      this.G = true;
      finish();
    }
    if (paramMenuItem.getItemId() == 4)
    {
      this.G = true;
      Toast.makeText(this, getString(2131099679), 0).show();
      MyApplication.a().b();
    }
    return true;
  }

  protected void onPause()
  {
    this.M = false;
    this.N = 200;
    if ((this.Q) && (this.S == 1))
    {
      this.Q = false;
      this.S = 2;
      this.p.setImageResource(2130837620);
      this.R = false;
    }
    this.Q = false;
    super.onPause();
  }

  protected void onResume()
  {
    this.Q = false;
    this.M = false;
    this.N = 0;
    if ((this.aR < this.aP - 1) && (MainControl.k))
      this.aR = (this.aP - 1);
    this.aO.setStreamVolume(3, this.aR, 0);
    if (!(MyApplication.a().n.equals("")))
    {
      this.g.setText(MyApplication.a().n);
      MyApplication.a().n = "";
    }
    if (MyApplication.a().q)
    {
      MyApplication.a().q = false;
      a(0);
    }
    super.onResume();
  }
}